package safari.model.member;

import java.sql.SQLException;

import org.mybatis.spring.SqlSessionTemplate;

public class MemberDaoImpl implements MemberDao {
	private SqlSessionTemplate sqlSessionTemplate;
	public MemberDaoImpl(SqlSessionTemplate sqlSessionTemplate){
		this.sqlSessionTemplate=sqlSessionTemplate;
	}
	
	@Override
	public int register(MemberVO mvo) throws SQLException {
		return sqlSessionTemplate.insert("member.register",mvo);
	}

	@Override
	public int update(MemberVO mvo) throws SQLException {
		return sqlSessionTemplate.update("member.update",mvo);
	}

	@Override
	public int delete(String id) throws SQLException {
		return sqlSessionTemplate.delete("member.delete",id);
	}

	@Override
	public MemberVO login(MemberVO mvo) throws SQLException {
		return sqlSessionTemplate.selectOne("member.login",mvo);
	}

	@Override
	public int findIdAndPassword(MemberVO mvo) throws SQLException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int idCheck(String id) throws SQLException {
		return sqlSessionTemplate.selectOne("member.idCheck",id);
	}

	@Override
	public MemberVO getInfo(String id) throws SQLException {
		return sqlSessionTemplate.selectOne("member.getinfo",id);
	}

}
